﻿using System.Collections;
using System.Collections.Generic;

namespace Unity.String
{
    internal readonly struct ReadOnlyListAdaptor<T> : IReadOnlyList<T>
    {
        readonly IList<T> _list;

        public ReadOnlyListAdaptor(IList<T> list) => this._list = list;

        public T this[int index] => this._list[index];

        public int Count => this._list.Count;

        public IEnumerator<T> GetEnumerator() => this._list.GetEnumerator();

        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
    }
}
